package cn.xeblog.forward.entity;

import cn.xeblog.forward.codec.MessageSerializer;
import lombok.Data;

import java.io.Serializable;

/**
 * @author eleven
 * @date 2024/12/16 8:01
 * @apiNote
 */
@Data
public class Message implements Serializable {
    private String id;

    private Integer messageType;

    private Integer sequenceId;

    private String serverName;

    private Integer index;

    private Integer code;

    private Object data;

    public static Message heartbeat() {
        Message message = new Message();
        message.setCode(200);
        message.setMessageType(MessageSerializer.Algorithm.JSON.ordinal());
        message.setSequenceId(1);
        message.setData("HEARTBEAT");
        return message;
    }
}
